package HighMethod01;

import java.util.Scanner;

/**
 * 求N！
 */
public class Test01 {

    public static int Fac(int n){
        if (n == 1||n == 0)
            return 1;
        return n*Fac(n-1);
    }

    public static int FacNon(int n){
        int result = 1;
        if (n == 1||n == 0)
            return 1;

        for(int i=1;i<=n;i++){
            result *= i;
        }
        return result;
    }

    public static void main(String[] args) {
        System.out.println("请输入一个数字：");
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();

        System.out.println("结果："+Fac(x));
        System.out.println("结果："+FacNon(x));
    }
}
